//
//  BookJourneyDetailSecondCell.m
//  FreeTrip
//
//  Created by 352324497@qq.com on 15/11/27.
//  Copyright © 2015年 邓芮. All rights reserved.
//

#import "BookJourneyDetailSecondCell.h"

@implementation BookJourneyDetailSecondCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.selectionStyle = NO;
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 10 * KScreenWidth/ 375, KScreenWidth, 30 * KScreenWidth / 375)];
        self.titleLabel.text = @"今日备忘";
//        self.titleLabel.backgroundColor = [UIColor grayColor];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:18 weight:0.01];
        [self.contentView addSubview:_titleLabel];
        
        self.menoLabel = [[UILabel alloc]initWithFrame:CGRectMake(10 * KScreenWidth / 375, 50 * KScreenWidth / 375 , KScreenWidth - 20 * KScreenWidth / 375, 10 * KScreenWidth / 375 + 30)];
        self.menoLabel.numberOfLines = 0;
        self.menoLabel.font = [UIFont systemFontOfSize:16 * KScreenWidth / 375];
        [self.titleLabel addSubview:_menoLabel];
        
    }
    return self;
}

-(void)setModel:(BookJournDetailDayModel *)model
{
    _model = model;
    self.menoLabel.text = model.memo;
    CGRect bounds = [model.memo boundingRectWithSize:CGSizeMake(KScreenWidth - 20 * KScreenWidth / 375, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:16 * KScreenWidth / 375] forKey:NSFontAttributeName] context:nil];
    self.menoLabel.frame = CGRectMake(10 * KScreenWidth / 375, 50 * KScreenWidth / 375, KScreenWidth - 20 * KScreenWidth / 375, bounds.size.height + 5);
}

+(CGFloat)heightForCell:(BookJournDetailDayModel *)model
{
    CGRect bounds = [model.memo boundingRectWithSize:CGSizeMake(KScreenWidth - 20 * KScreenWidth / 375, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:16 * KScreenWidth / 375] forKey:NSFontAttributeName] context:nil];
    
    return bounds.size.height + 70 * KScreenWidth / 375;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
